import os
import sys

a = str(input())
b = str(input())
a = sorted(a)
b = sorted(b)
if a == b:
    print("YES")
else:
    print("NO")